package com.weixingtu.commuterCar.servlet;

import com.alibaba.fastjson.JSONObject;
import com.weixingtu.commuterCar.bean.Line;
import com.weixingtu.commuterCar.bean.Message;
import com.weixingtu.commuterCar.service.LineService;
import com.weixingtu.commuterCar.service.impl.LineServiceImpl;
import com.weixingtu.commuterCar.tool.gps.impl.WWGps;
import com.weixingtu.commuterCar.util.JSONUtil;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Iterator;
import java.util.List;

@WebServlet(urlPatterns = "/delCarLoction.do")
public class DelCarLocInfoServlet extends HttpServlet {
    private LineService service = new LineServiceImpl();

    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        boolean isDel = service.delAll();
        Message msg = new Message();
        msg.setData(isDel);
        if (isDel) msg.setResult("删除成功");
        else msg.setResult("删除失败");
        String json = JSONUtil.toJSON(msg);
        PrintWriter writer = response.getWriter();
        writer.print(json);
    }

}
